home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
obero
/
oberon_lib.lha
/
oberon-a
/
source1.lha
/
source
/
Amiga
/
GadTools.mod
< prev
next >
Wrap
Text File
|
1994-08-08
|
25KB
|
736 lines
(***************************************************************************
$RCSfile: GadTools.mod $
Description: Interface to gadtools.library
Created by: fjc (Frank Copeland)
$Revision: 3.2 $
$Author: fjc $
$Date: 1994/08/08 01:11:04 $
Includes Release 40.15
(C) Copyright 1989-1993 Commodore-Amiga, Inc.
All Rights Reserved
Oberon-A interface Copyright © 1994, Frank Copeland.
This file is part of the Oberon-A Interface.
See Oberon-A.doc for conditions of use and distribution.
***************************************************************************)
MODULE GadTools;
(*
** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
** $V- OvflChk $Z- ZeroVars
*)
IMPORT
E := Exec, U := Utility, G := Graphics, I := Intuition, SYS := SYSTEM;
(*
** $VER: gadtools.h 39.9 (19.8.92)
**
** gadtools.library definitions
*)
(* -----------------------------------------------------------------------*)
(* The kinds (almost classes) of gadgets in the toolkit. Use these
identifiers when calling CreateGadgetA() *)
CONST
genericKind * = 0;
buttonKind * = 1;
checkBoxKind * = 2;
integerKind * = 3;
listViewKind * = 4;
mxKind * = 5;
numberKind * = 6;
cycleKind * = 7;
paletteKind * = 8;
scrollerKind * = 9;
(* Kind number 10 is reserved *)
sliderKind * = 11;
stringKind * = 12;
textKind * = 13;
numKinds * = 14;
(* -----------------------------------------------------------------------*)
CONST
(* 'Or' the appropriate set together for your Window IDCMPFlags: *)
arrowIdcmp * =
{ I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpIntuiTicks, I.idcmpMouseButtons };
buttonIdcmp * = { I.idcmpGadgetUp };
checkBoxIdcmp * = { I.idcmpGadgetUp };
integerIdcmp * = { I.idcmpGadgetUp };
listViewIdcmp * =
{ I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove } + arrowIdcmp;
mxIdcmp * = { I.idcmpGadgetDown };
numberIdcmp * = {};
cycleIdcmp * = { I.idcmpGadgetUp };
paletteIdcmp * = { I.idcmpGadgetUp };
(* Use ArrowIdcmp + ScrollerIdcmp if your scrollers have arrows: *)
scrollerIdcmp * =
{ I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove };
sliderIdcmp * =
{ I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove };
stringIdcmp * = { I.idcmpGadgetUp };
textIdcmp * = {};
(* -----------------------------------------------------------------------*)
TYPE
VisualInfo * = CPOINTER TO RECORD END;
(* Generic NewGadget used by several of the gadget classes: *)
NewGadgetPtr * = CPOINTER TO NewGadget;
NewGadget * = RECORD
leftEdge *,
topEdge * : INTEGER; (* gadget position *)
width *,
height * : INTEGER; (* gadget size *)
gadgetText * : E.STRPTR; (* gadget label *)
textAttr * : G.TextAttrPtr; (* desired font for gadget label *)
gadgetID * : E.UWORD; (* gadget ID *)
flags * : SET; (* see below *)
visualInfo * : VisualInfo; (* Set to retval of GetVisualInfo() *)
userData * : E.APTR; (* gadget UserData *)
END; (* NewGadget *)
CONST
(* flags control certain aspects of the gadget. The first five control
* the placement of the descriptive text. Each gadget kind has its default,
* which is usually placeTextLeft. Consult the autodocs for details.
*)
placeTextLeft * = 0; (* Right-align text on left side *)
placeTextRight * = 1; (* Left-align text on right side *)
placeTextAbove * = 2; (* Center text above *)
placeTextBelow * = 3; (* Center text below *)
placeTextIn * = 4; (* Center text on *)
ngHighLabel * = 5; (* Highlight the label *)
(* -----------------------------------------------------------------------*)
TYPE
(* Fill out an array of these and pass that to CreateMenus(): *)
NewMenuPtr * = CPOINTER TO NewMenu;
NewMenu * = RECORD
type * : SHORTINT; (* See below *)
(* Compiler inserts a PAD byte here *)
label * : E.STRPTR; (* Menu's label *)
commKey * : E.STRPTR; (* MenuItem Command Key Equiv *)
flags * : E.WSET; (* Menu or MenuItem flags (see note) *)
mutualExclude * : SET; (* MenuItem MutualExclude word *)
userData * : E.APTR; (* For your own use, see note *)
END; (* NewMenu *)
CONST
(* Needed only by inside im* definitions below *)
menuImage * = -128;
(* type determines what each NewMenu structure corresponds to.
* for the nmTitle, nmItem, and nmSub values, label should
* be a text string to use for that menu title, item, or sub-item.
* For imItem or imSub, set label to point at the Image structure
* you wish to use for this item or sub-item.
* NOTE: At present, you may only use conventional images.
* Custom images created from Intuition image-classes do not work.
*)
nmTitle * = 1;
nmItem * = 2;
nmSub * = 3;
imItem * = nmItem + menuImage;
imSub * = nmSub + menuImage;
(* The NewMenu array should be terminated with a NewMenu whose
* type equals nmEnd.
*)
nmEnd * = 0; (* End of NewMenu array *)
(* Starting with V39, GadTools will skip any NewMenu entries whose
* ype field has the nmIgnore bit set.
*)
nmIgnore * = 64;
(* nm_Label should be a text string for textual items, a pointer
* to an Image structure for graphical menu items, or the special
* constant nmBarlabel, to get a separator bar.
*)
nmBarLabel * = SYS.VAL(E.STRPTR, -1);
(* The nmFlags field is used to fill out either the Menu.flags or
MenuItem.flags field. Note that the sense of the menuEnabled or
itemEnabled bit is inverted between this use and Intuition's use,
in other words, NewMenus are enabled by default. The following
labels are provided to disable them: *)
nmMenuDisabled * = I.menuEnabled;
nmItemDisabled * = I.itemEnabled;
(* New for V39: nmCommandString. For a textual MenuItem or SubItem,
* point commKey at an arbitrary string, and set the nmCommandString
* flag.
*)
nmCommandString * = I.commSeq;
(* The following are pre-cleared (commSeq, itemText, and highxxx are set
* later as appropriate):
* Under V39, the commSeq flag bit is not cleared, since it now has
* meaning.
*)
nmFlagMask * = -({ I.commSeq, I.itemText } + I.highFlags);
nmFlagMaskV39 * = -({I.itemText} + I.highFlags);
(* You may choose among checkIt, menuToggle, and checked.
Toggle-select menuitems are of type checkIt | menuToggle, along
with checked if currently selected. Mutually exclusive ones
are of type checkIt, and possibly checked too. The nmMutualExclude
is a bit-wise representation of the items excluded by this one,
so in the simplest case (choose 1 among n), these flags would be
~1, ~2, ~4, ~8, ~16, etc. See the Intuition Menus chapter. *)
(* A UserData pointer can be associated with each Menu and MenuItem structure.
* The CreateMenus() call allocates space for a UserData after each
* Menu or MenuItem (header, item or sub-item). You should use the
* GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it.
*)
(*
#define GTMENU_USERDATA(menu) ( * ( (APTR * )(((struct Menu * )menu)+1) ) )
#define GTMENUITEM_USERDATA(menuitem) ( * ( (APTR * )(((struct MenuItem * )menuitem)+1) ) )
(* Here is an old one for compatibility. Do not use in new code! *)
#define MENU_USERDATA(menuitem) ( * ( (APTR * )(menuitem+1) ) )
*)
(* These return codes can be obtained through the gtmnSecondaryError tag *)
menuTrimmed * = 00000001H; (* Too many menus, items, or subitems,
menu has been trimmed down *)
menuInvalid * = 00000002H; (* Invalid NewMenu array *)
menuNoMem * = 00000003H; (* Out of memory *)
(*------------------------------------------------------------------------*)
(* Starting with V39, checkboxes and mx gadgets can be scaled to your
* specified gadget width/height. Use the new cbScaled or mxScaled
* tags, respectively. Under V37, and by default in V39, the imagery
* is of the following fixed size:
*)
CONST
(* MX gadget default dimensions: *)
mxWidth * = 17;
mxHeight * = 9;
(* Checkbox default dimensions: *)
checkboxWidth * = 26;
checkboxHeight * = 11;
(* -----------------------------------------------------------------------*)
CONST
(* Tags for GadTools functions: *)
tagBase * = U.tagUser + 80000H;
viNewWindow * = tagBase+1; (* Unused *)
viNWTags * = tagBase+2; (* Unused *)
private0 = tagBase+3; (* (private) *)
cbChecked * = tagBase+4; (* State of checkbox *)
lvTop * = tagBase+5; (* Top visible one in listview *)
lvLabels * = tagBase+6; (* List to display in listview *)
lvReadOnly * = tagBase+7; (* TRUE if listview is to be
* read-only
*)
lvScrollWidth * = tagBase+8; (* Width of scrollbar *)
mxLabels * = tagBase+9; (* NULL-terminated array of labels *)
mxActive * = tagBase+10; (* Active one in mx gadget *)
txText * = tagBase+11; (* Text to display *)
txCopyText * = tagBase+12; (* Copy text label instead of
* referencing it
*)
nmNumber * = tagBase+13; (* Number to display *)
cyLabels * = tagBase+14; (* NULL-terminated array of labels *)
cyActive * = tagBase+15; (* The active one in the cycle gad *)
paDepth * = tagBase+16; (* Number of bitplanes in palette *)
paColor * = tagBase+17; (* Palette color *)
paColorOffset * = tagBase+18; (* First color to use in palette *)
paIndicatorWidth * = tagBase+19; (* Width of current-color indicator *)
paIndicatorHeight * = tagBase+20; (* Height of current-color indicator *)
scTop * = tagBase+21; (* Top visible in scroller *)
scTotal * = tagBase+22; (* Total in scroller area *)
scVisible * = tagBase+23; (* Number visible in scroller *)
scOverlap * = tagBase+24; (* Unused *)
(* tagBase+25 through tagBase+37 are reserved *)
slMin * = tagBase+38; (* Slider min value *)
slMax * = tagBase+39; (* Slider max value *)
slLevel * = tagBase+40; (* Slider level *)
slMaxLevelLen * = tagBase+41; (* Max length of printed level *)
slLevelFormat * = tagBase+42; (* Format string for level *)
slLevelPlace * = tagBase+43; (* Where level should be placed *)
slDispFunc * = tagBase+44; (* Callback for number calculation
* before display
*)
stString * = tagBase+45; (* String gadget's displayed string *)
stMaxChars * = tagBase+46; (* Max length of string *)
inNumber * = tagBase+47; (* Number in integer gadget *)
inMaxChars * = tagBase+48; (* Max number of digits *)
mnTextAttr * = tagBase+49; (* MenuItem font TextAttr *)
mnFrontPen * = tagBase+50; (* MenuItem text pen color *)
bbRecessed * = tagBase+51; (* Make BevelBox recessed *)
visualInfo * = tagBase+52; (* result of VisualInfo call *)
lvShowSelected * = tagBase+53; (* show selected entry beneath
* listview, set tag data = NULL for display-only, or pointer
* to a string gadget you've created
*)
lvSelected * = tagBase+54; (* Set ordinal number of selected
* entry in the list
*)
reserved1 = tagBase+56; (* Reserved for future use *)
txBorder * = tagBase+57; (* Put a border around
* Text-display gadgets
*)
nmBorder * = tagBase+58; (* Put a border around
* Number-display gadgets
*)
scArrows * = tagBase+59; (* Specify size of arrows for
* scroller
*)
mnMenu * = tagBase+60; (* Pointer to Menu for use by
* LayoutMenuItems()
*)
mxSpacing * = tagBase+61; (* Added to font height to
* figure spacing between mx choices. Use this instead
* of layoutaSpacing for mx gadgets.
*)
(* New to V37 GadTools. Ignored by GadTools V36 *)
fullMenu * = tagBase+62; (* Asks CreateMenus() to
* validate that this is a complete menu structure
*)
secondaryError * = tagBase+63; (* tiData is a pointer
* to a ULONG to receive error reports from CreateMenus()
*)
underscore * = tagBase+64; (* tiData points to the symbol
* that preceeds the character you'd like to underline in a
* gadget label
*)
stEditHook * = tagBase+55; (* String EditHook *)
inEditHook * = stEditHook; (* Same thing, different name,
* just to round out integerKind gadgets
*)
(* New to V39 GadTools. Ignored by GadTools V36 and V37 *)
mnCheckmark * = tagBase+65; (* data is checkmark img to use *)
mnAmigaKey * = tagBase+66; (* data is Amiga-key img to use *)
mnNewLookMenus * = tagBase+67; (* data is boolean *)
(* New to V39 GadTools. Ignored by GadTools V36 and V37.
* Set to TRUE if you want the checkbox or mx image scaled to
* the gadget width/height you specify. Defaults to FALSE,
* for compatibility.
*)
cbScaled * = tagBase+68; (* data is boolean *)
mxScaled * = tagBase+69; (* data is boolean *)
paNumColors * = tagBase+70; (* Number of colors in palette *)
mxTitlePlace * = tagBase+71; (* Where to put the title *)
txFrontPen * = tagBase+72; (* Text color in textKind gad *)
txBackPen * = tagBase+73; (* Bgrnd color in textKind gad *)
txJustification * = tagBase+74; (* See j#? constants *)
nmFrontPen * = tagBase+72; (* Text color in numberKind gad *)
nmBackPen * = tagBase+73; (* Bgrnd color in numberKind gad *)
nmJustification * = tagBase+74; (* See j#? constants *)
nmFormat * = tagBase+75; (* Formatting string for number *)
nmMaxNumberLen * = tagBase+76; (* Maximum length of number *)
bbFrameType * = tagBase+77; (* defines what kind of boxes
* DrawBevelBox() renders. See
* the bbft#? constants for
* possible values
*)
lvMakeVisible * = tagBase+78; (* Make this item visible *)
lvItemHeight * = tagBase+79; (* Height of an individual item *)
slMaxPixelLen * = tagBase+80; (* Max pixel size of level display *)
slJustification * = tagBase+81; (* how should the level be displayed *)
paColorTable * = tagBase+82; (* colors to use in palette *)
lvCallBack * = tagBase+83; (* general-purpose listview call back *)
lvMaxPen * = tagBase+84; (* maximum pen number used by call back *)
txClipped * = tagBase+85; (* make a textKind clip text *)
nmClipped * = tagBase+85; (* make a numberKind clip text *)
(* Old definition, now obsolete: *)
reserved0 * = stEditHook;
(*------------------------------------------------------------------------*)
(* Justification types for txJustification and nmJustification tags *)
jLeft * = 0;
jRight * = 1;
jCenter * = 2;
(*------------------------------------------------------------------------*)
(* Bevel box frame types for bbFrameType tag *)
bbftButton * = 1; (* Standard button gadget box *)
bbftRidge * = 2; (* Standard string gadget box *)
bbftIconDropBox * = 3; (* Standard icon drop box *)
(* -----------------------------------------------------------------------*)
CONST
(* Typical suggested spacing between "elements": *)
interWidth * = 8;
interHeight * = 4;
(* -----------------------------------------------------------------------*)
CONST
(* "NWay" is an old synonym for cycle gadgets *)
nWAYKind * = cycleKind;
nWAYIDCMP * = cycleIdcmp;
nwLabels * = cyLabels;
nwActive * = cyActive;
(*------------------------------------------------------------------------*)
(* These two definitions are obsolete, but are here for backwards
* compatibility. You never need to worry about these:
*)
gadToolBit * = 15;
(* Use this mask to isolate the user part: *)
gadToolMask * = -{gadToolBit};
(*------------------------------------------------------------------------*)
(* These definitions are for the LV_CallBack tag *)
(* The different types of messages that a listview callback hook can see *)
lvDraw * = 0202H; (* draw yourself, with state *)
(* Possible return values from a callback hook *)
lvcbOk * = 0; (* callback understands this message type *)
lvcbUnknown * = 1; (* callback does not understand this message *)
(* states for LVDrawMsg.state *)
lvrNormal * = 0; (* the usual *)
lvrSelected * = 1; (* for selected gadgets *)
lvrNormalDisabled * = 2; (* for disabled gadgets *)
lvrSelectedDisabled * = 8; (* disabled and selected *)
TYPE
(* structure of lvDraw messages, object is an Exec.NodePtr *)
LVDrawMsg * = RECORD
methodID * : E.ULONG; (* lvDraw *)
rastPort * : G.RastPortPtr; (* where to render to *)
drawInfo * : I.DrawInfoPtr; (* useful to have around *)
bounds * : G.Rectangle; (* limits of where to render *)
state * : E.ULONG; (* how to render *)
END;
(**-- Library Base variable --------------------------------------------*)
TYPE
GadToolsBasePtr * = CPOINTER TO GadToolsBase;
GadToolsBase * = RECORD (E.Library) END;
CONST
name * = "gadtools.library";
VAR
base * : GadToolsBasePtr;
(**-- Library Functions ------------------------------------------------*)
(*
** $VER: gadtools_protos.h 39.2 (24.3.92)
*)
(* --- functions in V36 or higher (distributed as Release 2.0) ---*)
(* Gadget Functions *)
LIBCALL (base : GadToolsBasePtr) CreateGadgetA*
( kind [0] : E.ULONG;
gad [8] : I.GadgetPtr;
VAR ng [9] : NewGadget;
taglist [10] : ARRAY OF U.TagItem )
: I.GadgetPtr;
-30;
LIBCALL (base : GadToolsBasePtr) CreateGadget*
( kind [0] : E.ULONG;
gad [8] : I.GadgetPtr;
VAR ng [9] : NewGadget;
taglist [10].. : U.Tag )
: I.GadgetPtr;
-30;
LIBCALL (base : GadToolsBasePtr) FreeGadgets*
( gad [8] : I.GadgetPtr );
-36;
LIBCALL (base : GadToolsBasePtr) SetGadgetAttrsA*
( VAR gad [8] : I.Gadget;
win [9] : I.WindowPtr;
req [10] : I.RequesterPtr;
taglist [11] : ARRAY OF U.TagItem );
-42;
LIBCALL (base : GadToolsBasePtr) SetGadgetAttrs*
( VAR gad [8] : I.Gadget;
win [9] : I.WindowPtr;
req [10] : I.RequesterPtr;
taglist [11].. : U.Tag );
-42;
(* Menu functions *)
LIBCALL (base : GadToolsBasePtr) CreateMenusA*
( newmenu [8] : ARRAY OF NewMenu;
taglist [9] : ARRAY OF U.TagItem )
: I.MenuPtr;
-48;
LIBCALL (base : GadToolsBasePtr) CreateMenus*
( newmenu [8] : ARRAY OF NewMenu;
taglist [9].. : U.Tag )
: I.MenuPtr;
-48;
LIBCALL (base : GadToolsBasePtr) CreateMenusAB*
( newmenu [8] : NewMenuPtr;
taglist [9] : ARRAY OF U.TagItem )
: I.MenuPtr;
-48;
LIBCALL (base : GadToolsBasePtr) CreateMenusB*
( newmenu [8] : NewMenuPtr;
taglist [9].. : U.Tag )
: I.MenuPtr;
-48;
LIBCALL (base : GadToolsBasePtr) FreeMenus*
( menu [8] : I.MenuPtr );
-54;
LIBCALL (base : GadToolsBasePtr) LayoutMenuItemsA*
( firstitem [8] : I.MenuItemPtr;
vi [9] : VisualInfo;
taglist [10] : ARRAY OF U.TagItem )
: BOOLEAN;
-60;
LIBCALL (base : GadToolsBasePtr) LayoutMenuItems*
( firstitem [8] : I.MenuItemPtr;
vi [9] : VisualInfo;
taglist [10].. : U.Tag )
: BOOLEAN;
-60;
LIBCALL (base : GadToolsBasePtr) LayoutMenusA*
( firstmenu [8] : I.MenuPtr;
vi [9] : VisualInfo;
taglist [10] : ARRAY OF U.TagItem )
: BOOLEAN;
-66;
LIBCALL (base : GadToolsBasePtr) LayoutMenus*
( firstmenu [8] : I.MenuPtr;
vi [9] : VisualInfo;
taglist [10].. : U.Tag )
: BOOLEAN;
-66;
(* Misc Event-Handling Functions *)
LIBCALL (base : GadToolsBasePtr) GetIMsg*
( iport [8] : E.MsgPortPtr )
: I.IntuiMessagePtr;
-72;
LIBCALL (base : GadToolsBasePtr) ReplyIMsg*
( imsg [9] : I.IntuiMessagePtr );
-78;
LIBCALL (base : GadToolsBasePtr) RefreshWindow*
( win [8] : I.WindowPtr;
req [9] : I.RequesterPtr );
-84;
LIBCALL (base : GadToolsBasePtr) BeginRefresh*
( win [8] : I.WindowPtr );
-90;
LIBCALL (base : GadToolsBasePtr) EndRefresh*
( win [8] : I.WindowPtr;
complete [0] : E.LBOOL );
-96;
LIBCALL (base : GadToolsBasePtr) FilterIMsg*
( imsg [9] : I.IntuiMessagePtr )
: I.IntuiMessagePtr;
-102;
LIBCALL (base : GadToolsBasePtr) PostFilterIMsg*
( imsg [8] : I.IntuiMessagePtr )
: I.IntuiMessagePtr;
-108;
LIBCALL (base : GadToolsBasePtr) CreateContext*
( VAR glistptr [8] : I.GadgetPtr )
: I.GadgetPtr;
-114;
(* Rendering Functions *)
LIBCALL (base : GadToolsBasePtr) DrawBevelBoxA*
( rport [8] : G.RastPortPtr;
left [0] : LONGINT;
top [1] : LONGINT;
width [2] : LONGINT;
height [3] : LONGINT;
taglist [9] : ARRAY OF U.TagItem );
-120;
LIBCALL (base : GadToolsBasePtr) DrawBevelBox*
( rport [8] : G.RastPortPtr;
left [0] : LONGINT;
top [1] : LONGINT;
width [2] : LONGINT;
height [3] : LONGINT;
taglist [9].. : U.Tag );
-120;
(* Visuals Functions *)
LIBCALL (base : GadToolsBasePtr) GetVisualInfoA*
( screen [8] : I.ScreenPtr;
taglist [9] : ARRAY OF U.TagItem )
: VisualInfo;
-126;
LIBCALL (base : GadToolsBasePtr) GetVisualInfo*
( screen [8] : I.ScreenPtr;
taglist [9].. : U.Tag )
: VisualInfo;
-126;
LIBCALL (base : GadToolsBasePtr) FreeVisualInfo*
( vi [8] : VisualInfo );
-132;
(*--- functions in V39 or higher (Release 3) ---*)
LIBCALL (base : GadToolsBasePtr) GetGadgetAttrsA *
( gad [8] : I.GadgetPtr;
win [9] : I.WindowPtr;
req [10] : I.RequesterPtr;
taglist [11] : ARRAY OF U.TagItem )
: LONGINT;
-174;
LIBCALL (base : GadToolsBasePtr) GetGadgetAttrs *
( gad [8] : I.GadgetPtr;
win [9] : I.WindowPtr;
req [10] : I.RequesterPtr;
taglist [11]..: U.Tag )
: LONGINT;
-174;
(**-- C Macros defined as procedures -----------------------------------*)
(** $L+ Absolute long addressing for globals *)
(* A UserData pointer can be associated with each Menu and MenuItem structure.
The CreateMenus() call allocates space for a UserData after each
Menu or MenuItem (header, item or sub-item). You should use the
gtMenuUSERDATA() or gtMenuitemUSERDATA() macro to extract it. *)
(**-----------------------------------*)
PROCEDURE MenuUserData * (menu : I.MenuPtr) : E.APTR;
BEGIN (* MenuUserData *)
RETURN SYS.VAL (E.APTR, SYS.VAL (LONGINT, menu) + SIZE (I.Menu))
END MenuUserData;
(**-----------------------------------*)
PROCEDURE MenuItemUserData * (menuitem : I.MenuItemPtr) : E.APTR;
BEGIN (* MenuItemUserData *)
RETURN
SYS.VAL (E.APTR, SYS.VAL (LONGINT, menuitem) + SIZE (I.MenuItem))
END MenuItemUserData;
(**-- Library Base variable --------------------------------------------*)
(** $L- Address globals through A4 *)
(**-----------------------------------*)
PROCEDURE* CloseLib ();
BEGIN (* CloseLib *)
IF base # NIL THEN E.base.CloseLibrary (base) END
END CloseLib;
(**-----------------------------------*)
PROCEDURE OpenLib * (mustOpen : BOOLEAN);
BEGIN (* OpenLib *)
IF base = NIL THEN
base :=
SYS.VAL
( GadToolsBasePtr,
E.base.OpenLibrary (name, E.libraryMinimum));
IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
ELSIF mustOpen THEN HALT (100)
END;
END;
END OpenLib;
BEGIN
base := NIL
END GadTools.